package mainWindow;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.*;
import javax.swing.*;
import DataBase.*;
import wzr.*;
import edu.mit.jwi.item.POS;

public class PosPanel extends JPanel implements ChangeStyle
{
	private JScrollPane scrollPane = new JScrollPane();
	private JPanel panel = new JPanel();
	public PosPanel()
	{}
	public PosPanel(ArrayList<? extends Sense> senseList, POS pos)
	{
		setLayout(new BorderLayout());
		panel.setBackground(null);
		panel.setOpaque(false);
		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		if (pos == POS.NOUN)
		{
			add(new JLabel("<html><font size=5>The    </font><font size=7 color=GreenYellow>NOUN</font><font size=5>    has   </font><font size=7 color=red><i>" + senseList.size() + "</i></font><font size=5>   senses</font></html>"), BorderLayout.NORTH);
			for (int i = 0; i < senseList.size(); i ++)
			{
				NounSenseBlock senseBlock = new NounSenseBlock((NounSense) senseList.get(i), false, i + 1);
				panel.add(senseBlock);
			}
		}
		else if (pos == POS.VERB)
		{
			add(new JLabel("<html><font size=5>The    </font><font size=7 color=GreenYellow>VERB</font><font size=5>    has   </font><font size=7 color=red><i>" + senseList.size() + "</i></font><font size=5>   senses</font></html>"), BorderLayout.NORTH);
			for (int i = 0; i < senseList.size(); i ++)
			{
				VerbSenseBlock senseBlock = new VerbSenseBlock((VerbSense) senseList.get(i), false, i + 1);
				panel.add(senseBlock);
			}
		}
		else if (pos == POS.ADJECTIVE)
		{
			add(new JLabel("<html><font size=5>The    </font><font size=7 color=GreenYellow>ADJ</font><font size=5>    has   </font><font size=7 color=red><i>" + senseList.size() + "</i></font><font size=5>   senses</font></html>"), BorderLayout.NORTH);
			for (int i = 0; i < senseList.size(); i ++)
			{
				AdjSenseBlock senseBlock = new AdjSenseBlock((AdjSense) senseList.get(i), false, i + 1);
				panel.add(senseBlock);
			}
		}
		else
		{
			add(new JLabel("<html><font size=5>The    </font><font size=7 color=GreenYellow>ADV</font><font size=5>    has   </font><font size=7 color=red><i>" + senseList.size() + "</i></font><font size=5>   senses</font></html>"), BorderLayout.NORTH);
			for (int i = 0; i < senseList.size(); i ++)
			{
				AdvSenseBlock senseBlock = new AdvSenseBlock((AdvSense) senseList.get(i), false, i + 1);
				panel.add(senseBlock);
			}
		}
		panel.add(Box.createVerticalGlue());
		scrollPane.setBackground(null);
		scrollPane.setOpaque(false);
		scrollPane.getViewport().setOpaque(false);
		scrollPane.getVerticalScrollBar().setOpaque(false);
		scrollPane.setViewportView(panel);
		//scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		setMinimumSize(new Dimension(400, 300));
		setBackground(null);
		setOpaque(false);
		add(scrollPane);
		repaint();
	}
	@Override
	public void changeStyle(int styleIdx) {
		// TODO Auto-generated method stub
		
	}
}
